<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head><title>Cadastro de Clientes</title></h:head>

<h:body>
<ui:include src="/painel.xhtml"></ui:include>
	<h:form id="cliente">
		<p:panel header="Cadastro de Clientes">
			<h:panelGrid id="pg" columns="3">
				<h:outputText value="Nome: " />
				<p:inputText id="nomeCli" value="#{cliMB.cliente.nomeCliente}"  />
				<p:message for="nomeCli" showDetail="true"  />
				
				<h:outputText value="CPF: " />
				<p:inputText id="cpf" value="#{cliMB.cliente.cpf}" required="true" requiredMessage="Informe o cpf!" >
					<f:validateRegex pattern="[0-9]{11,11}" disabled="true" />
				</p:inputText>
				<p:message for="cpf" showDetail="true" />
						
				<h:outputText value="Login: " />
				<p:inputText id="loginCli" value="#{cliMB.usuario.login}" required="true" requiredMessage="Informe o login!">
					<f:validateRegex pattern="[A-Za-z/./_]{6,20}" />
				</p:inputText>
				<p:message for="loginCli" showDetail="true" />
				
				<h:outputText value="Senha: " />
				<p:inputText id="senha" value="#{cliMB.usuario.senha}" required="true" requiredMessage="Informe a senha para o login!">
					<f:validateRegex pattern="[A-Za-z/0-9/*/#/%]{6,20}" />
				</p:inputText>
				<p:message for="senha" showDetail="true" display="true" />
						
			</h:panelGrid>
			<br />
			<p:separator></p:separator>
			<br />
			<p:commandButton action="#{cliMB.cadastrarCli}" value="Cadastrar" update="@cliente, growl, pg" />
			<br /><br />
			<p:growl showDetail="true" showSummary="true" id="growl" />
			<p:message for="cliente" showDetail="true" styleClass="message"/>
		</p:panel>
	</h:form>

</h:body>

</html>